package com.neusmart.common.util;

import android.content.Context;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageSize;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;

public class ImageLoaderUtil {

    public static void display(String uri, ImageView imageView) {
        ImageLoader.getInstance().displayImage(uri, imageView);
    }

    public static void display(String uri, ImageView imageView, ImageLoadingListener listener) {
        ImageLoader.getInstance().displayImage(uri, imageView, listener);
    }

    public static void display(String uri, ImageView imageView, DisplayImageOptions displayOptions) {
        ImageLoader.getInstance().displayImage(uri, imageView, displayOptions);
    }

    public static void display(String uri, ImageView imageAware, DisplayImageOptions displayOptions, ImageLoadingListener listener) {
        ImageLoader.getInstance().displayImage(uri, imageAware, displayOptions, listener);
    }

    public static void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener) {
        ImageLoader.getInstance().loadImage(uri, targetImageSize, options, listener);
    }

    public static void displayFromSDCard(String uri, ImageView imageView) {
        ImageLoader.getInstance().displayImage("file://" + uri, imageView);
    }

    public static void dispalyFromAssets(String imageName, ImageView imageView) {
        ImageLoader.getInstance().displayImage("assets://" + imageName, imageView);
    }

    public static void displayFromDrawable(int imageId, ImageView imageView) {
        ImageLoader.getInstance().displayImage("drawable://" + imageId, imageView);
    }

    public static void displayFromContent(String uri, ImageView imageView) {
        ImageLoader.getInstance().displayImage("content://" + uri, imageView);
    }

    public static void clearMemoryCache() {
        ImageLoader.getInstance().clearMemoryCache();
    }

    public static void clearDiskCache() {
        ImageLoader.getInstance().clearDiskCache();
    }

}
